package book;

public class BookList {
    private Book books[];//为什么不可以这样private Book bookList[10];可以private Book bookList[]=new Book[10]
    private int usedSize;
//    public BookList(Book[] books, int usedSize) {
//        this.books = new Book[10];
//        this.usedSize = usedSize;//??
//    }
    //应该先想好是有参构造还是无参构造；
    public BookList() {
        //关于舒适化代码的一些细节？
        this.books=new Book[10];
        this.books[0]= new Book("三国演义","zm",12,"小说");
        this.books[1]= new Book("水浒传","zd",22,"小说");
        this.books[2]= new Book("Java","zx",52,"学习");
        //如何初始化书架
//        this.books=new Book[3]{
//                {"三国演义","zm",12,"小说",false}
//            {"水浒传","zd",19,"小说",false}
//            {"java","zx",52,"小说",false}
//        };
        this.usedSize=3;
    }

    public Book[] getBooks() {
        return books;
    }

    public void setBooks(Book[] books) {
        this.books = books;
    }

    public int getUsedSize() {
        return usedSize;
    }
//修改了原始setBook方法
    public void setBooks(Book book,int pos) {
        this.books[pos] =book;
    }
    public Book getBooks(int pos){
        return this.books[pos];
    }

    public void setUsedSize(int usedSize) {
        this.usedSize = usedSize;
    }

}
